﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Ongoal.Quotation;
using Ongoal.Quotation.Service.Common;
using Ongoal.Quotation.Service.Interface;
using Ongoal.Quotation.Service.Model;
using Ongoal.Quotation.Service.Model.Sys;

namespace Ongoal.Quotation.WebAPI.Controllers
{
    /// <summary>
    /// 数据项管理相关接口
    /// </summary>
    public class DataItemController : WebAPIBase
    {
        /// <summary>
        /// 实现类接口
        /// </summary>
        private IDataItemService _service;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="service"></param>
        public DataItemController(IDataItemService service)
        { 
            _service = service;
        }
        /// <summary>
        /// 查询数据项
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public object GetDataItem(int catagoryid) {
            return _service.GetDataItem(catagoryid);
        }
        /// <summary>
        /// 新增数据项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public object AddDataItem([FromBody]T_Sys_DataItem model) {
            return _service.AddDataItem(model);
        }
        /// <summary>
        /// 编辑数据项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public object EditDataItem([FromBody]T_Sys_DataItem model) {
            return _service.EditDataItem(model);
        }
        /// <summary>
        /// 删除数据项
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        [HttpPost]
        public object DeleteDataItem([FromBody]List<int> Ids) {
            return _service.DeleteDataItem(Ids);
        }
    }
}
